Skip to content

internal/transport: avoid mutating request URL for https+insecure - #1017

Merged
aalexand merged 1 commit into
google:mainfrom
cuishuang:fix-url-bug
Aug 24, 2026
Merged

internal/transport: avoid mutating request URL for https+insecure#1017
aalexand merged 1 commit into
google:mainfrom
cuishuang:fix-url-bug

Conversation

@cuishuang

Copy link
Copy Markdown
Contributor

transport.RoundTrip shallow-copies the request when handling https+insecure, but the copied request still shares the original *url.URL.

As a result, changing the copied URL scheme from https+insecure to https also mutates the caller's request.

Copy the url.URL value and update the copied request to point to the new value. Add a regression test that verifies the HTTPS request succeeds and the caller's URL scheme remains unchanged.

@aalexand
aalexand enabled auto-merge (squash) August 23, 2026 23:57
@codecov-commenter

codecov-commenter commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.20%. Comparing base (ef3492d) to head (08dd1b3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1017      +/-   ##
==========================================
- Coverage   67.35%   67.20%   -0.15%     
==========================================
  Files          44       45       +1     
  Lines        7793     7846      +53     
==========================================
+ Hits         5249     5273      +24     
- Misses       2112     2133      +21     
- Partials      432      440       +8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aalexand
aalexand merged commit c0b50f2 into google:main Aug 24, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants